package com.wyg.action;

import java.util.Map;

import com.wyg.pojo.User;

public class StrutsAction {

	private String name;
	private String password;
	private User user;
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	private Map<String,User> users;
	public Map<String, User> getUsers() {
		return users;
	}
	public void setUsers(Map<String, User> users) {
		this.users = users;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String registeMap() throws Exception{
		String name = getUsers().get("one").getName();
		String password = getUsers().get("one").getPassword();
		System.out.println("Map-------------");
		System.out.println(name);
		System.out.println(password);
		return "success";
	}
	
	public String registeUser() throws Exception{
		String name = getUser().getName();
		String password = getUser().getPassword();
		System.out.println("对象-------------");
		System.out.println(name);
		System.out.println(password);
		return "success";
	}
	
	public String execute() throws Exception{
		if(getName().equals("iotek")&&getPassword().equals("123")){
			return "success";
		}else{
			return "input";
		}
	}
}
